home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / gnulib / sipp / include / srgppubl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-01  |  9.5 KB  |  316 lines

  1. #include <stdio.h>
  2.  
  3.  
  4. #ifdef SRGP_BOSS
  5. #define DECLARE
  6. #else
  7. #define DECLARE extern
  8. #endif
  9.  
  10.  
  11. /** the special screen canvas ID**/
  12. #define SCREEN_CANVAS        0
  13.  
  14.  
  15. /** WRITE MODE **/
  16. typedef enum {WRITE_REPLACE=0, WRITE_XOR, WRITE_OR, WRITE_AND} writeMode;
  17.  
  18.  
  19. /** FILL STYLE or PEN STYLE  **/
  20. /* These *must* match the following X11 identifiers */
  21. typedef enum {
  22.    SOLID=0,                /*FillSolid*/
  23.    PIXMAP_PATTERN,            /*FillTiled*/
  24.    BITMAP_PATTERN_TRANSPARENT,        /*FillStippled*/
  25.    BITMAP_PATTERN_OPAQUE        /*FillOpaqueStippled*/
  26.  } drawStyle;
  27.  
  28.  
  29. /** SPECIAL DATA TYPES **/
  30. typedef int        (*funcptr)();
  31. typedef int        canvasID;
  32.  
  33.  
  34. /** GEOMETRIC DATA TYPES **/
  35. typedef struct {int x, y;}                srgp__point;
  36. typedef struct {srgp__point bottom_left, top_right;}    srgp__rectangle;
  37.  
  38.  
  39. /** ATTRIBUTE GROUP (application should never use internals) **/
  40. typedef struct {
  41.    int write_mode;
  42.    srgp__rectangle clip_rectangle;
  43.    int font;
  44.    lineStyle line_style;
  45.    int line_width;
  46.    int marker_size;
  47.    markerStyle marker_style;
  48.    int color, background_color;
  49.    int plane_mask;
  50.    drawStyle fill_style;
  51.    int fill_pixmap_pattern_id;
  52.    int fill_bitmap_pattern_id;
  53.    drawStyle pen_style;
  54.    int pen_pixmap_pattern_id;
  55.    int pen_bitmap_pattern_id;
  56. } srgp__attribute_group;
  57.  
  58.  
  59.  
  60.  
  61.  
  62. /** THE TIMESTAMP FOR INPUT DEVICE MEASURES **/
  63. typedef struct {
  64.    int seconds;
  65.    int ticks;
  66. } srgp_timestamp;
  67.  
  68.  
  69.  
  70.  
  71. /** LOCATOR MEASURE
  72. It is of utmost importance that the order of the fields not be changed!
  73. The "vanilla" and deluxe versions must "start off" identically.
  74. **/
  75.  
  76. typedef struct {
  77.    srgp__point position;
  78.    buttonStatus button_chord[3];
  79.    int button_of_last_transition;
  80. } srgp__locator_measure;
  81.  
  82. typedef struct {
  83.    srgp__point position;
  84.    buttonStatus button_chord[3];
  85.    int button_of_last_transition;
  86.    buttonStatus modifier_chord[3];
  87.    srgp_timestamp timestamp;
  88. } srgp__deluxe_locator_measure;
  89.  
  90. #define buttonChord button_chord
  91. #define buttonOfMostRecentTransition button_of_last_transition
  92.  
  93.  
  94.  
  95. /** KEYBOARD MEASURE **/
  96.  
  97. typedef char *srgp__keyboard_measure;
  98.  
  99. typedef struct {
  100.    char *buffer;
  101.    int buffer_length;
  102.    buttonStatus modifier_chord[3];
  103.    srgp__point position;
  104.    srgp_timestamp timestamp;
  105. } srgp__deluxe_keyboard_measure;
  106.  
  107.  
  108.  
  109. /** "CONSTANTS" GOVERNING THE SIZES OF INTERNAL TABLES
  110. Since the tables are malloc'd at runtime, these are not really constants.
  111. They are given default values, but these values may be changed by
  112. function calls IF these function calls are made before the application
  113. calls SRGP_begin().
  114. **/
  115.  
  116. DECLARE short MAX_PATTERN_INDEX
  117. #ifdef SRGP_BOSS
  118.               = DEFAULT_MAX_PATTERN_INDEX
  119. #endif
  120.       ;
  121. DECLARE short MAX_CURSOR_INDEX
  122. #ifdef SRGP_BOSS
  123.               = DEFAULT_MAX_CURSOR_INDEX
  124. #endif
  125.       ;
  126. DECLARE short MAX_FONT_INDEX
  127. #ifdef SRGP_BOSS
  128.               = DEFAULT_MAX_FONT_INDEX
  129. #endif
  130.       ;
  131. DECLARE short MAX_CANVAS_INDEX
  132. #ifdef SRGP_BOSS
  133.               = DEFAULT_MAX_CANVAS_INDEX
  134. #endif
  135.       ;
  136. DECLARE short MAX_STRING_SIZE
  137. #ifdef SRGP_BOSS
  138.               = DEFAULT_MAX_STRING_SIZE
  139. #endif
  140.       ;
  141. DECLARE short MAX_POINTLIST_SIZE
  142. #ifdef SRGP_BOSS
  143.               = DEFAULT_MAX_POINTLIST_SIZE
  144. #endif
  145.       ;
  146.  
  147.  
  148. void SRGP_setMaxCanvasIndex (int i);
  149. void SRGP_setMaxPatternIndex (int i);
  150. void SRGP_setMaxCursorIndex (int i);
  151. void SRGP_setMaxFontIndex (int i);
  152. void SRGP_setMaxPointlistSize (int i);
  153. void SRGP_setMaxStringSize (int i);
  154.  
  155.  
  156.  
  157.  
  158.  
  159. DECLARE int        SRGP_BLACK, SRGP_WHITE;
  160. #define COLOR_BLACK SRGP_BLACK
  161. #define COLOR_WHITE SRGP_WHITE
  162.  
  163. DECLARE FILE        *SRGP_logStream;
  164.  
  165. #undef DECLARE
  166.  
  167.  
  168. /* DEFINED ONLY IN THIS FILE SO I CAN
  169.    MAKE EACH PROTOTYPE FIT ON ONE LINE. */
  170. #define ush    unsigned short
  171. #define rect    srgp__rectangle
  172. #define pt    srgp__point
  173.  
  174.  
  175. /** ERROR HANDLING MODE **/
  176. typedef enum {FATAL_ERRORS, NON_FATAL_ERRORS}
  177.    errorHandlingMode;
  178.  
  179. extern int SRGP_errorOccurred;
  180.  
  181.  
  182. /** PROTOTYPES FOR ALL PUBLIC SRGP ROUTINES **/
  183.  
  184. /******************** attribute.c */
  185. void        SRGP_setAttributes (srgp__attribute_group*);
  186. void        SRGP_setBackgroundColor (int value);
  187. void        SRGP_setClipRectangle (rect);
  188. void        SRGP_setColor (int value);
  189. void        SRGP_setFillBitmapPattern (int value);
  190. void        SRGP_setFillPixmapPattern (int value);
  191. void        SRGP_setFillStyle (drawStyle);
  192. void        SRGP_setFont (int value);
  193. void        SRGP_setLineStyle (lineStyle);
  194. void        SRGP_setLineWidth (int value);
  195. void        SRGP_setMarkerStyle (markerStyle);
  196. void        SRGP_setMarkerSize (int value);
  197. void        SRGP_setPenBitmapPattern (int value);
  198. void        SRGP_setPenPixmapPattern (int value);
  199. void        SRGP_setPenStyle (drawStyle);
  200. void        SRGP_setPlaneMask (int value);
  201. void        SRGP_setWriteMode (writeMode);
  202.  
  203. /******************** canvas.c */
  204. canvasID    SRGP_createCanvas (int width, int height);
  205. void        SRGP_useCanvas (canvasID);
  206. void        SRGP_deleteCanvas (canvasID);
  207.  
  208. /******************** color.c */
  209. void        SRGP_loadCommonColor (int entry, char *name);
  210. void        SRGP_loadColorTable (int start, int cnt, ush *r, ush *g, ush *b);
  211. void        SRGP_loadSingleColor (int start, ush r, ush g, ush b);
  212.  
  213. /******************** cursor.c, font.c, pattern.c */
  214. void        SRGP_loadCursor (int index, int CURSOR_SHAPE);
  215. void        SRGP_loadFont (int font_index, char* filename);
  216. int        SRGP_loadBitmapPatternsFromFile (FILE*);
  217. int        SRGP_loadPixmapPatternsFromFile (FILE*);
  218. void        SRGP_loadBitmapPattern (int index, char *data);
  219. void        SRGP_loadPixmapPattern (int index, int *data);
  220.  
  221. /******************** input.c */
  222. void        SRGP_setInputMode (inputDevice, inputMode);
  223. inputDevice SRGP_waitEvent (int maximum_wait_time);
  224. void        SRGP_getLocator (srgp__locator_measure*);
  225. void        SRGP_getKeyboard (char *buf, int bufsize);
  226. void        SRGP_getDeluxeLocator (srgp__deluxe_locator_measure*);
  227. void        SRGP_getDeluxeKeyboard (srgp__deluxe_keyboard_measure*);
  228. void        SRGP_sampleLocator (srgp__locator_measure*);
  229. void        SRGP_sampleKeyboard (char *measure, int bufsize);
  230. void        SRGP_sampleDeluxeLocator (srgp__deluxe_locator_measure*);
  231. void        SRGP_sampleDeluxeKeyboard (srgp__deluxe_keyboard_measure*);
  232. void        SRGP_setLocatorMeasure (pt position);
  233. void        SRGP_setKeyboardMeasure (char*);
  234. void        SRGP_setLocatorEchoType (echoType);
  235. void        SRGP_setLocatorEchoCursorShape (int id);
  236. void        SRGP_setLocatorEchoRubberAnchor (pt position);
  237. void        SRGP_setLocatorButtonMask (int BUTTON_MASK);
  238. void        SRGP_setKeyboardProcessingMode (keyboardMode);
  239. void        SRGP_setKeyboardEchoColor (int value);
  240. void        SRGP_setKeyboardEchoOrigin (pt position);
  241. void        SRGP_setKeyboardEchoFont (int fontindex);
  242.  
  243. /******************** inquire.c */
  244. void        SRGP_inquireAttributes (srgp__attribute_group *att_group);
  245. rect        SRGP_inquireClipRectangle (void);
  246. canvasID    SRGP_inquireActiveCanvas (void);
  247. rect        SRGP_inquireCanvasExtent (canvasID id);
  248. void        SRGP_inquireCanvasSize (canvasID id, int *w, int *h);
  249. int        SRGP_inquireCanvasDepth (void);
  250. void        SRGP_inquireTextExtent (char *s, int *w, int *h, int *d);
  251. void        SRGP_inquireColorTable (int start, int cnt, ush *r, ush *g, ush *b);
  252. #ifdef X_PROTOCOL
  253. Drawable    SRGP_inquireXDrawable (canvasID);
  254. Display       *SRGP_inquireXDisplay (void);
  255. Window        SRGP_inquireXWindow (void);
  256. #endif
  257. #ifdef _GRX_H_
  258. GrContext  *SRGP_inquireGRXDrawable (canvasID canvas_id);
  259. #endif
  260.  
  261.  
  262. /******************** output.c */
  263. pt        SRGP_defPoint (int x, int y);
  264. rect        SRGP_defRectangle (int lx, int by, int rx, int t);
  265. void        SRGP_beep (void);
  266. void        SRGP_pointCoord (int x, int y);
  267. void        SRGP_point (pt);
  268. void        SRGP_polyPoint (int vCount, srgp__point *vertices);
  269. void        SRGP_polyPointCoord (int vCount, int *xs, int *ys);
  270. void        SRGP_markerCoord (int x, int y);
  271. void        SRGP_marker (pt);
  272. void        SRGP_polyMarker (int vCount, srgp__point *vertices);
  273. void        SRGP_polyMarkerCoord (int vCount, int *xlist, int *ylist);
  274. void        SRGP_lineCoord (int x1, int y1, int x2, int y2);
  275. void        SRGP_line (pt, pt);
  276. void        SRGP_rectangleCoord (int lx, int by, int rx, int ty);
  277. void        SRGP_rectanglePt (srgp__point bottom_left, srgp__point top_right);
  278. void        SRGP_rectangle (rect);
  279. void        SRGP_polyLine (int vCount, pt *vertices);
  280. void        SRGP_polyLineCoord (int vxCount, int *xlist, int *ylist);
  281. void        SRGP_polygon (int vCount, pt *vertices);
  282. void        SRGP_polygonCoord (int vCount, int *xlist, int *ylist);
  283. void        SRGP_fillRectangleCoord (int lx, int by, int rx, int ty);
  284. void        SRGP_fillRectanglePt (pt bl, pt tr);
  285. void        SRGP_fillRectangle (rect);
  286. void        SRGP_fillPolygon (int vCount, pt *vertices);
  287. void        SRGP_fillPolygonCoord (int vCount, int *xlist, int *ylist);
  288. void        SRGP_ellipse (rect);
  289. void        SRGP_ellipseArc (rect r, double a1, double a2);
  290. void        SRGP_fillEllipse (rect);
  291. void        SRGP_fillEllipseArc (rect r, double a1, double a2);
  292. void        SRGP_text (pt, char*);
  293. void        SRGP_refresh (void);
  294.  
  295. /******************** raster.c */
  296. void        SRGP_copyPixel (canvasID src, rect s, pt d);
  297.  
  298. /******************** state.c */
  299. void        SRGP_begin (char *name, int w, int h, int planes, boolean trace);
  300. void        SRGP_beginWithDebug
  301.         (char *name, int w, int h, int planes, boolean trace);
  302. void        SRGP_disableDebugAids (void);
  303. void        SRGP_enableBlockedWait (void);
  304. void        SRGP_setErrorHandlingMode (errorHandlingMode);
  305. void        SRGP_enableSynchronous (void);
  306. void        SRGP_tracing (boolean);
  307. void        SRGP_allowResize (boolean);
  308. void        SRGP_registerResizeCallback (funcptr);
  309. void        SRGP_changeScreenCanvasSize (int newwidth, int newheight);
  310. void        SRGP_end (void);
  311.  
  312.  
  313. #undef ush
  314. #undef rect
  315. #undef pt
  316.